<%--
  Created by IntelliJ IDEA.
  User: Lily
  Date: 2017/9/14
  Time: 13:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>新增管理员</title>
    <link rel="stylesheet" type="text/css" href="../js/util/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../js/util/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../js/util/easyui/demo/demo.css">
    <script type="text/javascript" src="../js/util/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="../js/util/easyui/jquery.easyui.min.js"></script>
    <%--这个js恩没有--%>
    <script type="text/javascript" src="../js/index/admin.js"></script>
    <script type="text/javascript">
        $.extend($.fn.validatebox.defaults.rules, {
            confirmPass: {
                validator: function (value, param) {
                    var pass = $(param[0]).passwordbox('getValue');
                    return value == pass;
                },
                message: '确认密码不匹配！'
            },
            newname: {
                validator: function (value, param) {
//                    return /^[a-z]+[0-9]+$/gi.test(value);
                    var loginname = value;
                    var name_check_1 = /[a-zA-Z]+/;//必须有字母
                    var name_check_2 = /[0-9]+/;//必须有数字
                    var name_check_3 = /^[a-zA-Z]{1}[a-zA-Z0-9_.]{5,19}$/;
                    var name_check = true;
                    var name_c = "用户名必须要有";
                    if (loginname == null) {
                        name_check = false;
                        name_c = "用户名不能为空";
                    }
                    if (!name_check_1.test(loginname)) {
                        name_check = false;
                        name_c = name_c + "字母（不论大小写）";
                    }
                    if (!name_check_2.test(loginname)) {
                        name_check = false;
                        name_c = name_c + "数字";
                    }
                    if (!name_check_3.test(loginname)) {
                        name_check = false;
                        name_c = "字母开头，不能出现除“_”“.”以外的特殊字符"
                    }
                    return name_check;
                },
                message: '管理员工号是6-20位字母和数字的组合（字母开头，不包含除“_”“.”以外的特殊字符）'
            },
            newpassowrd: {
                validator: function (value, param) {
                    return /^[a-z0-9_.]{6,20}$/gi.test(value);
                },
                message: '密码是6-20的字符组合（不包含除“_”“.”以外的特殊字符）'
            }
        });

        function add() {
            $('#addAdmin').form('submit', {
                onSubmit: function () {
                    return $(this).form('enableValidation').form('validate');
                }
            });

        }
    </script>
</head>
<body>
<div style="margin:20px 0;"></div>
<div class="easyui-panel" title="新增管理员" style="width:800px">
    <form id="addAdmin" action="../Admin/addAdmin" method="post" name="addAdmin">
        <%--;padding:50px 60px--%>
        <%--style="margin-bottom:20px"--%>
        <%--padding:上、右、下、左--%>
        <div style="padding:10px 60px 10px 60px">
            <p>请输入你要添加管理员的工号：</p>
            <input class="easyui-textbox" prompt="管理员工号" data-options="required:true"
                   validType="newname" name="loginname"
                   iconWidth="28" style="width:80%;height:34px;padding:10px;">
        </div>
        <div style="padding:0px 60px 10px 60px">
            <p>请设置密码：</p>
            <input id="pass" class="easyui-passwordbox" prompt="密码" data-options="required:true"
                   validType="newpassowrd" name="password"
                   iconWidth="28" style="width:80%;height:34px;padding:10px">
        </div>
        <div style="padding:0px 60px 20px 60px">
            <p>确认密码：</p>
            <input class="easyui-passwordbox" prompt="确认密码" data-options="required:true"
                   name="repassword"
                   iconWidth="28" validType="confirmPass['#pass']" style="width:80%;height:34px;padding:10px">
        </div>
        <div style="padding:0px 60px 20px 60px">
            <td>请选择新增管理员的身份：</td>
            <td><label>
                <select name="select" class="easyui-combobox" data-options="editable:false" style="width:80px;">
                    <option selected value="4">车长</option>
                    <option value="5">票务</option>
                </select>
            </label></td>
        </div>
        <div style="padding:0px 60px 20px 60px">
            <div>上传头像:</div>
            <div>
                头像: <img id="userIcon" class="user-icon" src="../icons/icon.jpg" style="width: 200px;height: 200px">
                <input type="hidden" id="icon" name="icon">
            </div>
            <input class="easyui-filebox" name="imagePath" data-options="prompt:'选择上传头像...'"
                   style="width:80%">
        </div>
    </form>
    <iframe id="uploader">
    </iframe>

    <div style="padding:10px 60px 20px 60px">
        <%--<input id="buttonTeat" type="submit" value="提交" onclick="login()">--%>
        <a class="easyui-linkbutton" onclick="add()" style="width: 80px">提交</a>
    </div>
</div>
</body>
</html>
